package jdbc;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

public class ADD {
    public static void main(String[] args){
        try (
                Connection connection = DBUtil.getConnection();
        ) {
            Statement statement = connection.createStatement();
            String sql = "INSERT INTO user VAlUES (null,'刘德华')";
            int num = statement.executeUpdate(sql);
            if (num>0){
                System.out.println("添加成功");
            }else {
                System.out.println("插入失败");
            }
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }


    }
}
